<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" href="css/login.css"/>
		<link rel="stylesheet" href="css/mui.css" />
		<link rel="stylesheet" href="css/mui.min.css" />
		<title>login</title>
	</head>
	<body>	
		<div class="Sign_in">
				<p class="Sign_in_with_Restaurant_number">Sign in with Restaurant<br />number</p>
				<p class="YOUR_NUMBER">YOUR NUMBER</p>
	
				<input type="text" class="phone" name="LoginId" id="LoginId"
					style="width:8.5rem;height: 9%;  border-style: none none none none;background-color:transparent;" placeholder="Account number" />
				<div class="name_right">	
					
				</div>
				
				<p class="PASSWORD">PASSWORD</p>
				
				<input type="password" class="word" name="password" id="password"
					style="width:8.5rem;height: 9%; border-style: none none none none;background-color:transparent; padding-top: 0.5rem;" placeholder="Password" />
		
				<div class="pass">
					
				</div>
				<div class="sign_in">
					<div class="bg" id="login">
						<p class="SIGN_IN" >SIGN IN</p>
					</div> 
			
			
				</div> 
			    <p class="Don_t_have_an_account__Sign_Up">Don't have an account? <strong><span>Sign Up</span></strong></p>
		</div>
	<script src="js/mui.js"></script>
	<script src="js/mui.min.js"></script>
	<script type="text/javascript">
		document.addEventListener('DOMContentLoaded', function() {
				var html = document.documentElement;
				var windowWidth = html.clientWidth;
				html.style.fontSize = windowWidth / 10.8 + 'px';
			}, false);
	</script>
	<script>
		(function($, doc) {
				$.init({
					statusBarBackground: '#f7f7f7'
				});

				$.plusReady(function() {

				})
				document.getElementById('login').addEventListener('tap', function() {
					//$("#test").val()
					//LoginId=LoginId&password=password
					var loginiddate = $("#LoginId")[0].value;
					var passworddate = $("#password")[0].value;
					var postdate = "LoginId=" + loginiddate + "&password=" + passworddate;
					mui.ajax('http://api.jhjnzx.com/api/Login/Post', {
						data: postdate,
						type: 'post',
						contentType: "application/x-www-form-urlencoded; charset=utf-8",
						timeout: 60000,
						success: function(data) {
							 if (data.Success) {
                            //为简单起见，将token保存在全局变量中。
                            window.token = data.Token;
                            //var StoreId=data.UserID;
                            var StoreId=1;
                            localStorage.setItem("StoreId", StoreId);
                            mui.openWindow({
					url: 'main.html'
				});
                        } else {
                            alert("登录失败:" + data.Message);
                        }
						},
						error: function(xhr, type, errorThrown) {
							alert(xhr.responseText);
						}
					});
					var backButtonPress = 0;
					$.back = function(event) {
						backButtonPress++;
						if(backButtonPress > 1) {
							plus.runtime.quit();
						} else {
							plus.nativeUI.toast('再按一次退出应用');
						}
						setTimeout(function() {
							backButtonPress = 0;
						}, 1000);
						return false;
					};
				});
			}(mui, document));
	</script>

	</body>
</html>
